package com.qianli.cashmama.trade.client.trade.request;

import com.fqgj.common.api.ParamsObject;
import com.fqgj.exception.common.ApplicationException;
import com.qianli.cashmama.trade.common.enums.UsageOfLoanEnum;
import org.apache.commons.lang.StringUtils;

import java.util.Date;

/**
 * @program: cashmama-trade-center
 * @description
 * @author: frank
 * @create: 2020-11-19 11:34
 **/
public class CreatePaySuccessTradeRequest extends ParamsObject {

    private String userCode;
    /**
     * 交易号
     */
    private String tradeNo;
    /**
     * 渠道号
     */
    private String channelCode;
    /**
     * 产品code
     */
    private String productCode;
    /**
     * 借款用途
     */
    private UsageOfLoanEnum usageOfLoan;
    /**
     * 姓名
     */
    private String userName;
    /**
     * 产品类目
     */
    private String productCategory;
    /**
     * 到账金额
     */
    private String arrivalAmount;
    /**
     * 待还款金额
     */
    private String repaymentAmount;
    /**
     * 利息
     */
    private String interestAmount;
    /**
     * 手续费
     */
    private String costFee;
    /**
     * 逾期费率
     */
    private String overdueFee;
    /**
     * 手续费率
     */
    private String costRate;
    /**
     * 利息费率
     */
    private String interestRate;
    /**
     * 逾期费率
     */
    private String overdueRate;
    /**
     * 贷款期限
     */
    private Integer loanTerm;
    /**
     * 放款时间
     */
    private Date loanTime;
    /**
     * 到期时间
     */
    private Date dueTime;

    public String getUserName() {
        return userName;
    }

    public CreatePaySuccessTradeRequest setUserName(String userName) {
        this.userName = userName;
        return this;
    }

    @Override
    public void validate() {
        if (StringUtils.isEmpty(userCode)) {
            throw new ApplicationException("userCode can not be empty");
        }
        if (StringUtils.isEmpty(tradeNo)) {
            throw new ApplicationException("tradeNo can not be empty");
        }
        if (StringUtils.isEmpty(channelCode)) {
            throw new ApplicationException("channelCode can not be empty");
        }
        if (usageOfLoan == null) {
            throw new ApplicationException("usageOfLoan can not be empty");
        }
        if (StringUtils.isEmpty(productCategory)) {
            throw new ApplicationException("productCategory can not be empty");
        }
        if (StringUtils.isEmpty(arrivalAmount)) {
            throw new ApplicationException("arrivalAmount can not be empty");
        }
        if (StringUtils.isEmpty(repaymentAmount)) {
            throw new ApplicationException("repaymentAmount can not be empty");
        }
        if (StringUtils.isEmpty(interestAmount)) {
            throw new ApplicationException("interestAmount can not be empty");
        }
        if (StringUtils.isEmpty(costFee)) {
            throw new ApplicationException("costFee can not be empty");
        }
        if (StringUtils.isEmpty(overdueFee)) {
            throw new ApplicationException("overdueFee can not be empty");
        }
        if (loanTerm == null) {
            throw new ApplicationException("loanTerm can not be empty");
        }
        if (loanTime == null) {
            throw new ApplicationException("loanTime can not be empty");
        }
        if (dueTime == null) {
            throw new ApplicationException("dueTime can not be empty");
        }
    }

    public String getUserCode() {
        return userCode;
    }

    public CreatePaySuccessTradeRequest setUserCode(String userCode) {
        this.userCode = userCode;
        return this;
    }

    public String getTradeNo() {
        return tradeNo;
    }

    public CreatePaySuccessTradeRequest setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
        return this;
    }

    public String getChannelCode() {
        return channelCode;
    }

    public CreatePaySuccessTradeRequest setChannelCode(String channelCode) {
        this.channelCode = channelCode;
        return this;
    }

    public String getProductCode() {
        return productCode;
    }

    public CreatePaySuccessTradeRequest setProductCode(String productCode) {
        this.productCode = productCode;
        return this;
    }

    public UsageOfLoanEnum getUsageOfLoan() {
        return usageOfLoan;
    }

    public CreatePaySuccessTradeRequest setUsageOfLoan(UsageOfLoanEnum usageOfLoan) {
        this.usageOfLoan = usageOfLoan;
        return this;
    }

    public String getProductCategory() {
        return productCategory;
    }

    public CreatePaySuccessTradeRequest setProductCategory(String productCategory) {
        this.productCategory = productCategory;
        return this;
    }

    public String getArrivalAmount() {
        return arrivalAmount;
    }

    public CreatePaySuccessTradeRequest setArrivalAmount(String arrivalAmount) {
        this.arrivalAmount = arrivalAmount;
        return this;
    }

    public String getRepaymentAmount() {
        return repaymentAmount;
    }

    public CreatePaySuccessTradeRequest setRepaymentAmount(String repaymentAmount) {
        this.repaymentAmount = repaymentAmount;
        return this;
    }

    public String getInterestAmount() {
        return interestAmount;
    }

    public CreatePaySuccessTradeRequest setInterestAmount(String interestAmount) {
        this.interestAmount = interestAmount;
        return this;
    }

    public String getCostFee() {
        return costFee;
    }

    public CreatePaySuccessTradeRequest setCostFee(String costFee) {
        this.costFee = costFee;
        return this;
    }

    public String getOverdueFee() {
        return overdueFee;
    }

    public CreatePaySuccessTradeRequest setOverdueFee(String overdueFee) {
        this.overdueFee = overdueFee;
        return this;
    }

    public String getCostRate() {
        return costRate;
    }

    public CreatePaySuccessTradeRequest setCostRate(String costRate) {
        this.costRate = costRate;
        return this;
    }

    public String getInterestRate() {
        return interestRate;
    }

    public CreatePaySuccessTradeRequest setInterestRate(String interestRate) {
        this.interestRate = interestRate;
        return this;
    }

    public String getOverdueRate() {
        return overdueRate;
    }

    public CreatePaySuccessTradeRequest setOverdueRate(String overdueRate) {
        this.overdueRate = overdueRate;
        return this;
    }

    public Integer getLoanTerm() {
        return loanTerm;
    }

    public CreatePaySuccessTradeRequest setLoanTerm(Integer loanTerm) {
        this.loanTerm = loanTerm;
        return this;
    }

    public Date getLoanTime() {
        return loanTime;
    }

    public CreatePaySuccessTradeRequest setLoanTime(Date loanTime) {
        this.loanTime = loanTime;
        return this;
    }

    public Date getDueTime() {
        return dueTime;
    }

    public CreatePaySuccessTradeRequest setDueTime(Date dueTime) {
        this.dueTime = dueTime;
        return this;
    }
}
